import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

const store = new Vuex.Store({

	state() {
		return {}
	},

	mutations: {
		REMOVE_UNFINISHED_FILE(state, value) {
			plus.io.requestFileSystem(plus.io.PUBLIC_DOWNLOADS, entry => {
				//创建目录对象的读取对象
				var directoryReader = entry.root.createReader();
				directoryReader.readEntries(fs => {
					//使用some方法提高性能
					fs.some((el,index,arr) => {
						// console.log(index+'-'+arr.length)
							if (el.toURL() === value) {
								el.remove(success => {
									console.log('删除未完成的:'+value)
								}, e => {})
								return true
							}
						})
				})
			}, e => {
				console.log('error')
			})
		}

	},
	actions: {

	},

})

export default store
